<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div  class="box"></div>
    <script src="../template-web.js"></script>
    <script  type="text/html"  id='user'>
     <h2>{{title}}</h2>
     <h3>{{name}}</h3>
     <img src="{{img}}" alt="图片">
    </script>
    
    <script>
    let data={
        title:'欢迎来到王的世界',
        name:'王',
        img:'https://tse3-mm.cn.bing.net/th/id/OIP-C.SVJS_bkI3PRKBaQwes2YZAHaIV?w=197&h=222&c=7&r=0&o=5&pid=1.7'
    }
    let htmlText=template('user',data)
    document.querySelector('.box').innerHTML=htmlText
    </script>
</body>
</html>